#include "Cavalier.h"
#include "iostream"

using namespace std;

Cavalier::Cavalier()
{}

Cavalier::Cavalier(int x,int y, bool white)
{
    m_x = x;
    m_y = y;
    m_white = white;

}
char
Cavalier::tostring()
{
   return( isWhite() ? 'C' : 'c');
}

void
Cavalier::affiche()
{
    cout << "Pion: x=" << m_x << " y=" << m_y << " "
         << ( isWhite() ? "blanche" : "noire" ) << endl;

}

bool
Cavalier::mouvementvalide(Echiquier *e, int x, int y )
{
    if(Piece::mouvementvalide(e,x,y))
    {

        return((x == m_x - 1 && y == m_y - 2)
            || (x == m_x + 1 && y == m_y-2)
            || (x == m_x -2 && y == m_y -1)
            || (x == m_x +2 && y == m_y -1)
            || (x == m_x -2 && y == m_y +1)
            || (x == m_x - 1 && y == m_y + 2)
            || (x == m_x +1 && y == m_y +1)
            || (x == m_x +1 && y == m_y +2));
    }
    else
    {
        return false;
    }
}


Cavalier::~Cavalier(){}
